

<link rel="stylesheet" href="{{URL::asset('./css/store/store.css')}}">
<style type="text/css">
    .btn_box {
        margin-top: 20px;
        display:flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 40px;
    }
    .btn_c{
        width: 80px;
        height: 30px;
        background: rgba(209, 0, 24, 1);
        border-radius: 2px;
        margin-left: 20px;
        display:flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        color: #fff;
        cursor: pointer;
    }
</style>
@section('content')
    @include('home.store.storeHeader')
    <div class="main" id="store"  v-cloak>
    <div class="companyProfile">
        <div class="companyProfile_name">
            <span class="messageTitle">公司简介</span>
            <span class="messageTitle_2">Our profile</span>
            <span class="bottomTriangle"></span>
        </div>
        <div class="companyProfile_details">
            <div>
                <p class="title">@{{storeDetails.store_name}}</p>
                <p class="text">@{{storeDetails.description}}</p>
                <div class="lookDetail"><a :href="'{{route('home.store.storeSummary')}}?id='+storeId">查看简介</a></div>
            </div>
            <img :src="storeDetails.logo">
        </div>
    </div>
        <div class="companyPicture" v-if="storeImg.length>0">
        <div class="companyProfile_name">
            <span class="messageTitle">图片展示</span>
            <span class="messageTitle_2">Our pictures</span>
            <span class="bottomTriangle"></span>
        </div>
        <div class="companyPicture_details">
            <div>
                <el-carousel :interval="4000" type="card" arrow="always" height="220px" indicator-position="none">
                    <el-carousel-item v-for="item in storeImg" :key="item">
                        <a><img :src="item" alt="" style="width:100%;height:100%"></a>
                    </el-carousel-item>
                </el-carousel>
            </div>
        </div>
        </div>
        <div class="companyServe" v-if="storeService.length>0">
        <div class="companyProfile_name">
            <span class="messageTitle">服务内容</span>
            <span class="messageTitle_2">service contents</span>
            <span class="bottomTriangle"></span>
        </div>
        <div class="companyServe_details">
            <div v-for="(item,index) in storeService" v-if="index<6"  @click="getServiceDetails(item.id)">
                <div class="companyServe_details_title">
                    <img :src="item.thumb" alt="">
                    <span>@{{item.title}}</span>
                </div>
                <div class="companyServe_details_main">
                    <p style="width: 295px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">服务详情：@{{item.content}}</p>
                    <span>
                        @{{item.summary}}
                    </span>
                    <div @click="getServiceDetails(item.id)">查看详情 ></div>
                </div>
            </div>
            <div class="noStore" v-if="storeService.length == 0 || !storeService">暂无更多服务</div>
            <div class="noStore" v-if="storeService.length == 1">暂无更多服务</div>
            <div class="noStore" v-if="storeService.length == 2">暂无更多服务</div>
        </div>
        </div>
        <div class="companyCase" v-if="storeCase.length>0">
        <div class="companyProfile_name">
            <span class="messageTitle">案例展示</span>
            <span class="messageTitle_2">Case presentation</span>
            <span class="bottomTriangle"></span>
        </div>
        <div class="companyCase_details">
            <div class="companyCase_details_main">
                <div v-for="(item,index) in storeCase" v-if="index<3" @click="window.location.href = '{{ route('home.store.casesDetails') }}?id='+storeId+'&caseId='+item.id">
                    <img :src="item.thumb" alt="">
                    <div class="companyCase_details_right">
                        <span>@{{item.title}}</span>
                        <span>
                            案例详情：@{{item.content}}
                        </span>
                    </div>
                </div>
            </div>
        </div>
        </div>
        <div class="companyPartners" v-if="storePartners.length>0">
        <div class="companyProfile_name">
            <span class="messageTitle">合作伙伴</span>
            <span class="messageTitle_2">Partners</span>
            <span class="bottomTriangle"></span>
        </div>
        <div class="companyPartners_details">
            <!-- <div v-for="(item,index) in storePartners">
                <img :src="item" alt="">
            </div> -->
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div v-for="(item,index) in storePartners" class="swiper-slide" :style="{backgroundImage:'url('+item+')'}"></div>
                </div>
            </div>
        </div>
        </div>
        <div class="btn_box">
            <p class="btn_c" @click="returnStore">返回</p>
            <p class="btn_c" style="margin-left:100px;" @click="submitFrom">提交审核</p>
        </div>
    </div>
@endsection
@section('scripts')
    <script>
    $(() => {
        let store = new Vue({
            el: '#store',
            data: () => {
                return {
                    loading: false,
                    storeDetailData: {},
                    storeId: getQueryString("id"),
                    storeDetails: {},
                    storeImg: [],
                    storeService: [],
                    storeCase: [],
                    storePartners: [],
                    storeEvaluates: [],
                    storeEvaluatesStore: [],
                    storeEvaluatesList: [],
                    evaluatesType: 1,
                    storeType:2
                }
            },
            created() {
                this.storeDetailData = {
                    id: this.storeId,
                }
                this.getStoreDetails(this.storeDetailData);
                this.getStroreImg(this.storeDetailData);
                this.getService(this.storeDetailData);
                this.getCase(this.storeDetailData);
                this.getPartners(this.storeDetailData);
                this.getEvaluates(this.storeDetailData);
            },
            mounted() {},
            methods: {
                returnStore(){
                    window.location.href = `{{route('home.suppliermy.supplierStoreEdit') }}?id=${this.storeId}`
                },
                submitFrom(){
                    let data = {
                        store_id:getQueryString("id"),
                        post_type:3
                    };
                    apiAjax("{{ route('home.user.supplierStoreUpdateApi')}}", 'post', data, (res) => {
                        if (res.code == 0) {
                                this.$message({
                                    message: res.msg,
                                    type: 'success'
                                });
                                window.location.replace("{{ route('home.suppliermy.supplierStore') }}")
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });
                        }
                        }, (erro) => {
                        });
                },
                getStoreDetails(storeDetailData) {
                    apiAjax("{{ route('home.store.storeprevapi')}}", 'post', {
                        store_id: this.storeId,
                        user_id: JSON.parse(sessionStorage.getItem("HRuserDetails")).id
                    }, (res) => {
                        if (res.code == 0) {
                            this.storeDetails = res.data;
                        } else {}
                    }, (erro) => {});
                },
                getStroreImg(storeDetailData) {
                    apiAjax("{{ route('home.store.imageApi')}}", 'get', storeDetailData, (res) => {
                        if (res.code == 0) {
                            this.storeImg = res.data.image||[];
                        } else {}
                    }, (erro) => {});
                },
                getService(storeDetailData) {
                    apiAjax("{{ route('home.store.serviceApi')}}", 'get', storeDetailData, (res) => {
                        if (res.code == 0) {
                            this.storeService = res.data ||[];
                        } else {}
                    }, (erro) => {});
                },
                getServiceDetails(id) {
                    window.location.href = "{{ route('home.store.serviceDetails') }}?id=" + this.storeId + "&serviceId=" + id
                },
                getCase(storeDetailData) {
                    let a = JSON.parse(JSON.stringify(storeDetailData));
                    a['page'] = 1
                    apiAjax("{{ route('home.store.casesApi')}}", 'get', a, (res) => {
                        if (res.code == 0) {
                            this.storeCase = res.data.data||[];
                        } else {}
                    }, (erro) => {});
                },
                getCaseMore() {
                    window.location.href = "{{ route('home.store.storeCases') }}?id=" + this.storeId

                },
                getPartners(storeDetailData) {
                    apiAjax("{{ route('home.store.partnersApi')}}", 'get', storeDetailData, (res) => {
                        if (res.code == 0) {
                            this.storePartners = res.data.partners||[];
                            this.$nextTick(()=>{
                                var galleryThumbs = new Swiper('.swiper-container', {
                                spaceBetween: 10,
                                slidesPerView: 5,
                                // loop: true,
                                autoplay:true,
                                autoplayDisableOnInteraction : false,
                                loopedSlides: 5,
                                observer: true, //修改swiper自己或子元素时，自动初始化swiper
                                observeParents: true, //修改swiper的父元素时，自动初始化swiper
                            });
                            })
                        } else {}
                    }, (erro) => {});
                },
                getEvaluates(storeDetailData) {
                    this.loading = true;
                    let a = JSON.parse(JSON.stringify(storeDetailData));
                    a['type'] = this.evaluatesType;
                    a['page'] = 1;
                    apiAjax("{{ route('home.store.evaluatesList')}}", 'get', a, (res) => {
                        this.loading = false;

                        if (res.code == 0) {
                            this.storeEvaluatesStore = res.data.store;
                            this.storeEvaluatesList = res.data.list;
                        } else {}
                    }, (erro) => {
                        this.loading = false;

                    });
                },
                changeEvaluates(type) {
                    this.evaluatesType = type;
                    this.getEvaluates(this.storeDetailData);
                },
                getEvaluatesMore() {
                    window.location.href = "{{ route('home.store.storeEvaluates') }}?id=" + this.storeId
                },
            }
        })
    })
</script>
@endsection

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="description" content="">
    <meta name="_token" content="{{csrf_token()}}">
    <meta name="keyword" content="">
    <link rel="shortcut icon" href="{{ asset('favicon.ico') }}">
    <title>{!! $title !!}</title>
    <link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ asset('css/font-awesome.min.css') }}" rel="stylesheet" />
    <link href="{{ asset('css/swiper.min.css') }}" rel="stylesheet" />
    <script src="{{ asset('js/swiper.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('js/jquery-1.8.3.min.js') }}" type="text/javascript"></script>
    <link rel="stylesheet" href="{{URL::asset('./css/reset.css')}}">
    <script src="{{ asset('js/pdfjs/pdf.js') }}"></script>
    <script src="https://unpkg.com/clipboard@2/dist/clipboard.min.js"></script>
    <script src="{{ asset('js/jquery.lazyload.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('js/qrcode.min.js') }}" type="text/javascript"></script>
    <style type="text/css">
        [v-cloak] {
            display: none !important;
        }
    </style>
    @yield('styles')

</head>

<body>
@yield('content')
<script src="{{ asset('js/vue.min.js') }}" type="text/javascript"></script>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="{{ asset('js/element.js') }}" type="text/javascript"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="{{ asset('js/moment.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/public.js') }}" type="text/javascript"></script>
<script src="{{ asset('js/bootstrap.min.js') }}" type="text/javascript"></script>
@yield('compontentScipts')
@yield('scripts')
<link rel="stylesheet" href="{{URL::asset('./css/public.css')}}">
</body>
<script>
    $.ajaxSetup({
        contentType: 'application/json;charset=utf-8'
    });
    let data = {}
    apiAjax("{{ route('home.public.config')}}", 'get', data, (res) => {
        sessionStorage.setItem("overall", JSON.stringify(res.data))

    }, (erro) => {});
    let right_floorapp = new Vue({
        el: '#right_floor',
        data: {
            overall: JSON.parse(sessionStorage.getItem("overall")) || {},
        },
        created() {},
        mounted() {

            $(document).ready(() => {
                $(document).scroll(() => {
                    let topHeight = $(document).scrollTop();
                    let clientWidth = document.body.clientWidth;
                    let astrictHeight = 650;
                    if (topHeight > astrictHeight) {
                        $(".right_floor").slideDown("fast", () => {
                            $(".right_floor").css("display", "grid")
                            $(".right_floor").css("overflow", "inherit");
                        })
                    } else {
                        $(".right_floor").hide("fast")
                    }


                });
            });
        },
        methods: {
            addDemand() {
                if (sessionStorage.getItem("HRuserDetails")) {
                    if (JSON.parse(sessionStorage.getItem("HRuserDetails")).type == 2) {
                        this.$message({
                            message: "请登录HR用户账号",
                            type: 'warning'
                        });
                    } else {
                        window.location.href = "{{ route('home.demand.demandAdd') }}";
                    }
                } else {
                    this.$message({
                        message: "请先登录账号！！",
                        type: 'warning'
                    });
                }
            },
            goTop() {
                $('html,body').animate({
                    scrollTop: '0px'
                }, 1000);
            },
            clickMo() {
                if (sessionStorage.getItem("HRuserDetails")) {
                    if (JSON.parse(sessionStorage.getItem("HRuserDetails")).type == 2) {
                        window.location.href = "{{ route('home.suppliermy.supplierFeedBack') }}";
                    } else if (JSON.parse(sessionStorage.getItem("HRuserDetails")).type == 1) {
                        window.location.href = "{{ route('home.hrmy.hrFeedBack') }}";
                    }
                } else {
                    this.$message({
                        message: "请先登录！",
                        type: 'warning'
                    });
                }
            },
        }
    })
    let loginDialog = new Vue({
        el: '#loginDialog',
        data: {
            overall: JSON.parse(sessionStorage.getItem("overall")) || {},
            dialogVisible: false,
            dialogVisibleApply: false,

            activeBo: 1,
            form: {
                tel: "",
                password: '',
                code: ''
            },
            telRule: [{
                required: true,
                validator: validateTel,
                trigger: 'blur'
            }],
            passRule: [{
                required: true,
                message: '密码不能为空',
                trigger: 'blur'
            }],
            codeRule: [{
                required: true,
                message: '验证码不能为空',
                trigger: 'blur'
            }],
            codeBo: false,
            codeTime: 60,
            submitBo: false,
            form2: {
                name: '',
                sex: 1,
                num: 1,
                tel: '',
                email: '',
                companyName: '',
                department: '',
                post: '',
                companyType: '',
                companyIndustry: '',
                companyEmployees: '',
                HREmployees: '',
                qq:''
            },
            rule2: {
                name: [{
                    required: true,
                    message: '姓名不能为空',
                    trigger: 'blur'
                }],
                num: [{
                    required: true,
                    validator: validatePositiveNum,
                    trigger: 'blur'
                }],
                sex: [{
                    required: true,
                    message: '请选择性别',
                    trigger: 'blur'
                }],
                email: [{
                    required: true,
                    validator: validateEmail,
                    trigger: 'blur'
                }],
                companyName: [{
                    required: true,
                    message: '公司名称不能为空',
                    trigger: 'blur'
                }],
                department: [{
                    required: true,
                    message: '部门不能为空',
                    trigger: 'blur'
                }],
                post: [{
                    required: true,
                    message: '职位不能为空',
                    trigger: 'blur'
                }],
                companyType: {
                    required: true,
                    message: '公司类型不能为空',
                    trigger: 'change'
                },
                companyIndustry: {
                    required: true,
                    message: '公司行业不能为空',
                    trigger: 'change'
                },
                companyEmployees: {
                    required: true,
                    message: '员工人数不能为空',
                    trigger: 'change'
                },
                HREmployees: {
                    required: true,
                    message: 'HR部门人数不能为空',
                    trigger: 'change'
                },
                tel: [{
                    required: true,
                    validator: validateTel,
                    trigger: 'blur'
                }],
            },
            remenberBo: false,
            companyTypeData: [],
            companyIndustryData: [],
            companyEmployeesData: [],
            HREmployeesData: [],
        },
        watch: {
            dialogVisibleApply(newV) {
                if (newV) {
                    this.setForm(JSON.parse(sessionStorage.getItem("HRuserDetails")))
                }
            }
        },
        created() {
            //监听值 判断登录窗口
            window.addEventListener("setItemEvent", (e) => {
                this.dialogVisible = e.loginBool || false; //登录窗口
                this.dialogVisibleApply = e.applyBool || false; //报名窗口
            });
            //公司类型
            apiAjax("{{ route('home.public.companys') }}", 'get', {
                type: 1
            }, (res) => {
                this.companyTypeData = res.data;
            });
            //公司行业
            apiAjax("{{ route('home.public.companys') }}", 'get', {
                type: 2
            }, (res) => {
                this.companyIndustryData = res.data;
            });
            //公司规模（员工人数）
            apiAjax("{{ route('home.public.companys') }}", 'get', {
                type: 3
            }, (res) => {
                this.companyEmployeesData = res.data;
            });
            //HR部门人数
            apiAjax("{{ route('home.public.companys') }}", 'get', {
                type: 4
            }, (res) => {
                this.HREmployeesData = res.data;
            });
        },
        mounted() {},
        methods: {
            closeTitle(){
                sessionStorage.setItem("applyBool", false);
            },
            handleClose(done) {
                this.dialogVisible = false;
                this.dialogVisibleApply = false;
            },
            setActiveBo(num) {
                if (this.submitBo) {} else {
                    this.activeBo = num;
                    this.$refs['form'].resetFields();
                }
            },

            getCode() {
                if (this.codeTime == 60) {
                    $.get("{{ route('home.public.config') }}", (res) => {
                        this.codeBo = true
                        let a = setInterval(() => {
                            this.codeTime -= 1;
                            if (this.codeTime == 0) {
                                this.codeBo = false;
                                this.codeTime = 60;
                                clearInterval(a)
                            }
                        }, 1000);
                    });
                }
            },
            //登录
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.submitBo = true;
                        //账号密码登录
                        if (this.activeBo == 1) {
                            let data = {
                                mobile: this.form.tel,
                                password: this.form.password,
                            }
                            apiAjax("{{ route('home.login.login') }}", 'post', data, (res) => {
                                if (res.code == 0) {
                                    this.$message({
                                        message: '登录成功',
                                        type: 'success'
                                    });
                                    sessionStorage.setItem("HRuserDetails", JSON.stringify(res.data));
                                    this.setForm(res.data)
                                } else {
                                    this.$message({
                                        message: res.msg,
                                        type: 'warning'
                                    });
                                }
                                this.submitBo = false;
                            }, (erro) => {
                                this.submitBo = false;
                            });
                            //验证码登录
                        } else {
                            let data = {
                                mobile: this.form.tel,
                                code: this.form.password,
                            }
                            apiAjax("{{ route('home.login.login') }}", 'post', data, (res) => {
                                if (res.code == 0) {
                                    this.$message({
                                        message: '登录成功',
                                        type: 'success'
                                    });
                                    sessionStorage.setItem("HRuserDetails", JSON.stringify(res.data))

                                    this.setForm(res.data)
                                } else {
                                    this.$message({
                                        message: res.msg,
                                        type: 'warning'
                                    });
                                }
                                this.submitBo = false;
                            }, (erro) => {
                                this.submitBo = false;
                            });
                        }

                    } else {
                        return false;
                    }
                });
            },
            setForm(data) {
                sessionStorage.setItem("loginBool", false);
                if (JSON.parse(sessionStorage.getItem("HRuserDetails")).type == 2) {
                    this.$message({
                        message: "请登录HR用户账号",
                        type: 'warning'
                    });
                } else {
                    sessionStorage.setItem("applyBool", true);
                    apiAjax("{{ route('home.activity.actSignUpDataApi')}}", 'get', {}, (res) => {
                        if (res.code == 0) {
                            this.form2.name = res.data.nickname;
                            this.form2.sex = res.data.sex || 1;
                            this.form2.tel = res.data.mobile;
                            this.form2.email = res.data.email;
                            this.form2.companyName = res.data.user_info.company_name || '';
                            this.form2.department = res.data.user_info.hr_department || '';
                            this.form2.post = res.data.user_info.hr_position || '';
                            this.form2.companyType = res.data.user_info.company_type || '';
                            this.form2.companyIndustry = res.data.user_info.company_industry || '';
                            this.form2.companyEmployees = res.data.user_info.company_size || '';
                            this.form2.HREmployees = res.data.user_info.hr_size || '';
                            this.form2.qq = res.data.qq;
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });

                        }
                    }, (erro) => {

                    });

                }
            },
            remenberPass() {
                this.remenberBo = !this.remenberBo;
            },
            //报名
            submitFormApply(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        if (this.remenberBo) {
                            if (this.form2.num == 0) {
                                this.$message({
                                    message: '请填写正确的报名人数',
                                    type: 'warning'
                                });
                            } else {
                                let data = {
                                    activity_id: getQueryString("cateId"),
                                    user_name: this.form2.name,
                                    sex: this.form2.sex,
                                    phone: this.form2.tel,
                                    email: this.form2.email,
                                    company: this.form2.companyName,
                                    department: this.form2.department,
                                    position: this.form2.post,
                                    type: this.form2.companyType,
                                    industry: this.form2.companyIndustry,
                                    size: this.form2.companyEmployees,
                                    hr_size: this.form2.HREmployees,
                                    number: this.form2.num,
                                    qq:this.form2.qq
                                }
                                apiAjax("{{ route('home.activity.actSignUpApi')}}", 'post', data, (res) => {
                                    if (res.code == 0) {
                                        if (res.data) {
                                            window.location.href = "{{ route('home.activity.actPay')}}?id=" + res.data
                                        } else {
                                            this.$message({
                                                message: res.msg,
                                                type: 'success'
                                            });
                                            window.location.href = "{{ route('home.hrmy.hrActivity') }}"
                                        }
                                    } else {
                                        this.$message({
                                            message: res.msg,
                                            type: 'warning'
                                        });

                                    }
                                }, (erro) => {

                                });
                            }

                        } else {
                            this.$message({
                                message: '请确定法律声明与隐私条款',
                                type: 'warning'
                            });
                        }

                    } else {
                        return false;
                    }
                });
            },
        }
    })
    let storelistTitle = new Vue({
        el: '#storelistTitle',
        data: () => {
            return {
                // userInfo: {},
                // footprint: [],
            }
        },
    });
    // 头部
    $(function() {
        // $("img").lazyload({
        //     threshold: 200,
        //     effect: "fadeIn",
        //     failure_limit: 20
        // });
        let headerapp = new Vue({
            el: '#header',
            data: function() {
                return {
                    searchInput: getQueryString("keyword") || "",
                    seleted: {
                        id: 1,
                        title: "供应商"
                    },
                    headerLogo: "",
                    seleteData: [],
                    advsTop: [],
                    userData: {},
                    showNab: "",
                    thumbBool:true,
                }
            },
            watch: {},
            created() {
                const that = this
                let type = parseInt(getQueryString("select"))
                that.seleted = JSON.parse(sessionStorage.getItem("seleted"))
                if(type){
                    switch (type){
                        case 1:
                            that.seleted = {
                                id: 1,
                                title: "供应商"
                            }
                            sessionStorage.setItem("seleted", JSON.stringify(that.seleted))
                            break;
                        case 2:
                            that.seleted = {
                                id: 2,
                                title: "活动"
                            }
                            sessionStorage.setItem("seleted", JSON.stringify(that.seleted))
                            break;
                        case 3:
                            that.seleted = {
                                id: 3,
                                title: "商品"
                            }
                            sessionStorage.setItem("seleted", JSON.stringify(that.seleted))
                            break;
                        case 4:
                            that.seleted = {
                                id: 4,
                                title: "需求"
                            }
                            sessionStorage.setItem("seleted", JSON.stringify(that.seleted))
                            break;
                        case 5:
                            that.seleted = {
                                id: 5,
                                title: "新闻"
                            }
                            sessionStorage.setItem("seleted", JSON.stringify(that.seleted))
                            break;
                        case 6:
                            that.seleted = {
                                id: 6,
                                title: "文档"
                            }
                            sessionStorage.setItem("seleted", JSON.stringify(that.seleted))
                            break;
                        default:
                            that.seleted = {
                                id: 1,
                                title: "供应商"
                            }
                            sessionStorage.setItem("seleted", JSON.stringify(that.seleted))
                    }
                }

                window.addEventListener("setItemEvent", (e) => {
                    if (e.overall) {
                        this.headerLogo = JSON.parse(e.overall).site_logo;
                    }
                    if (e.HRuserDetails) {
                        this.userData = JSON.parse(e.HRuserDetails) || '';
                    }
                });
                this.getSelectData();
                if(sessionStorage.getItem("overall") ) {
                    // this.headerLogo = sessionStorage.getItem("overall") ?
                    // JSON.parse(sessionStorage.getItem("overall")).site_logo : '';
                    this.headerLogo = JSON.parse(sessionStorage.getItem("overall")).site_logo
                }else {
                    this.headerLogo = ''
                }

                this.userData = JSON.parse(sessionStorage.getItem("HRuserDetails")) || '';
                // 获取地址栏的最后route
                let pathnameArr = window.location.pathname.split('/');
                this.showNab = pathnameArr[(pathnameArr.length - 1)];
                if (this.showNab == 'storelist' ||
                    this.showNab == 'actcate' ||
                    this.showNab == 'actlist' ||
                    this.showNab == 'actadd' ||
                    this.showNab == 'actdetails' ||
                    this.showNab == 'goodscate' ||
                    this.showNab == 'goodsadd' ||
                    this.showNab == 'goodslist' ||
                    this.showNab == 'goodsdetails' ||
                    this.showNab == 'wordcate' ||
                    this.showNab == 'wordlist' ||
                    this.showNab == 'worddetails' ||
                    this.showNab == 'news' ||
                    this.showNab == 'newsdetails' ||
                    this.showNab == 'demandadd' ||
                    this.showNab == 'demandlist' ||
                    this.showNab == 'demandhrdetails' ||
                    this.showNab == 'demandsupplierdetails' ||
                    this.showNab == 'supplierbalanceadd' ||
                    this.showNab == 'supplierbalanceaddorder' ||
                    this.showNab == 'supplierbalanceaddfinish' ||
                    this.showNab == 'cartlist' ||
                    this.showNab == 'suppliergoodsupdate'
                ) {
                    this.showNab = pathnameArr[(pathnameArr.length - 1)];
                } else {
                    this.showNab = '';

                }
                window.$message = (res) => {
                    this.$message({
                        message: res,
                        type: 'error'
                    });
                }
            },
            methods: {
                close(){
                    $(".header_advertising").slideUp(500)
                },
                goHrUser(){
                    window.location.href = "{{ route('home.hrmy.hrIndex') }}";
                },
                // 购物车
                goOrder(){
                    window.location.href = "{{ route('home.cart.cartList') }}";
                },
                goActive(){
                    window.location.href = "{{route('home.hrmy.hrActivity') }}";
                },
                goUser(){
                    window.location.href = "{{ route('home.suppliermy.supplierIndex') }}";
                },
                goToubiao(){
                    window.location.href = "{{route('home.suppliermy.supplierBidding')}}"
                },
                goCz(){
                    window.location.href =  "{{route('home.suppliermy.supplierBalanceAdd')}}"
                },
                loginOut() {
                    let data = {}
                    apiAjax("{{ route('home.login.logout')}}", 'get', data, (res) => {
                        if (res.code == 0) {
                            this.$message({
                                message: res.msg,
                                type: 'success'
                            });
                            sessionStorage.removeItem("HRuserDetails");
                            window.location.href = "{{ route('home.login.login')}}";
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });

                        }
                    }, (erro) => {});
                },
                signHandle() {
                    let data = {
                        userId: this.userData.id
                    }
                    if (this.userData.is_sign != 1) {
                        apiAjax("{{ route('home.user.userSignInApi') }}", 'post', data, (res) => {
                            if (res.code == 0) {
                                this.$message({
                                    message: '签到成功',
                                    type: 'success'
                                });
                                sessionStorage.setItem("HRuserDetails", JSON.stringify(res.data))
                                this.userData = JSON.parse(sessionStorage.getItem("HRuserDetails"))
                            } else {
                                this.$message({
                                    message: res.msg,
                                    type: 'warning'
                                });
                            }
                            this.submitBo = false;
                        }, (erro) => {
                            this.submitBo = false;
                        });
                    }
                },
                updateSelect(item) {
                    this.seleted = item;
                },
                getSelectData() {
                    this.loading = true;
                    // $.get("{{ route('home.public.navbars') }}", (res) => {
                    //     this.seleted = res.data[0] || {}
                    //     this.seleteData = res.data;
                    // });
                    $.get("{{ route('home.public.advs') }}", {
                        adsense_id: 4
                    }, (res) => {
                        this.advsTop = res.data || []
                    });
                    this.seleteData = [{
                        title: '供应商',
                        id: 1
                    }, {
                        title: '活动',
                        id: 2
                    }, {
                        title: '商品',
                        id: 3
                    }, {
                        title: '需求',
                        id: 4
                    }, {
                        title: '新闻',
                        id: 5
                    }, {
                        title: '文档',
                        id: 6
                    }];
                    // this.seleted = this.seleteData[0]
                },
                searchRoute() {

                    let data = {
                        keyword: this.searchInput,
                        type: this.seleted.id,
                    }
                    apiAjax("{{ route('home.search.searchApi')}}", 'get', data, (res) => {
                        if (res.code == 0) {
                            // this.$message({
                            //     message: res.msg,
                            //     type: 'success'
                            // });
                            switch (this.seleted.id) {
                                case 1: //供应商
                                    window.location.href = "{{ route('home.store.storeList') }}?keyword=" + this.searchInput;
                                    break;
                                case 2: //活动
                                    window.location.href = "{{ route('home.activity.actList') }}?keyword=" + this.searchInput;

                                    break;
                                case 3: //商品
                                    window.location.href = "{{ route('home.goods.goodsList') }}?keyword=" + this.searchInput;
                                    break;
                                case 4: //需求
                                    window.location.href = "{{ route('home.demand.demandList') }}?keyword=" + this.searchInput;
                                    break;
                                case 5: //新闻
                                    window.location.href = "{{ route('home.news.news') }}?keyword=" + this.searchInput;
                                    break;
                                case 6: //文档
                                    window.location.href = "{{ route('home.word.wordList') }}?keyword=" + this.searchInput;
                                    break;
                                default:
                                    this.$message({
                                        message: "请选择查询项！！",
                                        type: 'warning'
                                    });
                                    break;
                            }
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });

                        }
                    }, (erro) => {

                    });
                },
                // 点击发布需求
                clickDemand() {
                    if (sessionStorage.getItem("HRuserDetails")) {
                        if (JSON.parse(sessionStorage.getItem("HRuserDetails")).type == 2) {
                            this.$message({
                                message: "请登录HR用户账号",
                                type: 'warning'
                            });
                        } else {
                            window.location.href = "{{ route('home.demand.demandAdd') }}";
                        }
                    } else {
                        this.$message({
                            message: "请先登录账号！！",
                            type: 'warning'
                        });
                    }
                },
                //点击发布活动
                clickAct() {
                    if (sessionStorage.getItem("HRuserDetails")) {
                        if (JSON.parse(sessionStorage.getItem("HRuserDetails")).type == 2) {
                            window.location.href = "{{ route('home.activity.actAdd') }}";
                        } else {
                            this.$message({
                                message: "请登录供应商账号",
                                type: 'warning'
                            });
                        }
                    } else {
                        this.$message({
                            message: "请先登录账号！！",
                            type: 'warning'
                        });
                    }
                },
                //点击发布商品
                clickGoods() {
                    if (sessionStorage.getItem("HRuserDetails")) {
                        if (JSON.parse(sessionStorage.getItem("HRuserDetails")).type == 2) {
                            window.location.href = "{{ route('home.suppliermy.supplierGoodsUpdate') }}";
                        } else {
                            this.$message({
                                message: "请登录供应商账号",
                                type: 'warning'
                            });
                        }
                    } else {
                        this.$message({
                            message: "请先登录账号！！",
                            type: 'warning'
                        });
                    }
                },
            }
        });
    })
</script>
</html>